from datetime import datetime

DEAL_PAYMENT = 1
DEAL_DEPOSIT = 2
DEAL_CHECK   = 3

def view(req):
    if req==3:
        return 3
    else:
        return 0

class Model:
    time = datetime.now()
    note = ""

    # Nested declaration
    class Admin:
        list    = ('id', 'time')
        order   = ('asc', 'desc')

class Deal(Model):
    # Deal types
    # Integer as in database
    TYPE = ( (DEAL_PAYMENT,  'Payment'),
            (DEAL_DEPOSIT,  'Deposit'),
            (DEAL_CHECK,    'Check'),) 

    user = "thumb.py"

    def get_absolute_url(self):
        return "/deals/%s" % self.user

    """
    Multiple line comment
    Logic checks
    """
    def get_display_name(self, type):
        if type==DEAL_PAYMENT:
            return 'Payment'
        elif type==DEAL_DEPOSIT:
            return 'Deposit'
        else:
            return 'Check'
